function r = vpa(x, d)
%VPA - 变精度算法将符号 x 计算到 d 位有效数字.
%
% 语法:
%   r = vpa(x);      - d 的默认数值为 32.
%   r = vpa(x, d);
%
% 示例:
% >> p = sym(pi);
% >> vpa(p)
% 3.1415926535897932384626433832795
% >> a = sym(1/3);
% >> x = sym('x');
% >> f = a*sin(2*p*x);
% >> vpa(f, 4)      % 该功能有缺陷
% 0.3333*sin(2*pi*x)
%
    narginchk(1, 2)
    if nargin == 1
        d = 32;
    end
    sp = sympy_sp;
    x = sym(x);
    r = sp.N(x, d);
end

